import React, { Component } from 'react'
import { Route } from 'react-router-dom'

export default class Index extends Component {
    render() {
        const { routeList } = this.props
        return (
            <React.Fragment>
                {
                    routeList.map((item, index) => {
                        return <Route path = { item.path } render = {() => {
                            let Com = item.component
                            if (item.children) {
                                return <Com child = { item.children }/>
                            } else {
                                return <Com/>
                            }
                        }} key = { index }/>
                    })
                }
            </React.Fragment>
        )
    }
}
